package router

import "github.com/gin-gonic/gin"

func JsonRoute(router gin.IRouter) {
	router.GET("/someJson", func(c *gin.Context) {
		c.JSON(200, gin.H{
			"message": "hello json",
		})
	})

	router.GET("/moreJson", func(c *gin.Context) {
		var msg struct {
			Name    string `json:"user"`
			Message string
			Age     int
		}
		msg.Name = "小王子"
		msg.Message = "Hello world!"
		msg.Age = 18

		c.JSON(200, msg)
	})
}
